contact = jQuery.noConflict();

contact().ready(function() {
					

	/* var addNewSpan = '<span id="errormsg_container"></span>';
        contact("#announcements-node-form").before(addNewSpan);*/

  contact("#contact-dir-form-node-form").validate({	
										 
					rules: {
						   'field_cont_dept[und]': { 
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
						},
						
						'field_cont_org_name[und]':{
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
							
							},
							
						
						'field_cont_type[und]':{
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
							
							},
							
						'field_cont_salutation[und]':{
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
							
							},
						'title':{
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '',
							
							},
						'field_cont_desg[und][0][value]':{
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '',
							
							},
							
						'field_cont_email[und][0][value]':{
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							email:true,
						},
						'field_website[und][0][value]':{
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							url:true,
						},
						'field_cont_phone1[und][0][value]':{
							minlength: 2,
							maxlength: 6,
							chkbadchar:true,
							digits:true,
						},
						'field_cont_phone[und][0][value]':{
							minlength: 4,
							maxlength: 8,
							chkbadchar:true,
							digits: true,
						},
						'field_cont_phone2[und][0][value]':{
							minlength: 2,
							maxlength: 6,
							chkbadchar:true,
							digits:true,
						},
						'field_cont_mobile[und][0][value]':{
							minlength: 10,
							maxlength: 11,
							chkbadchar:true,
							digits:true,
						},
						
						'field_cont_cfax[und][0][value]':{
							minlength: 2,
							maxlength: 6,
							chkbadchar:true,
							digits: true,
						},
						'field_cont_cfax[und][0][value]':{
							minlength: 2,
							maxlength: 6,
							chkbadchar:true,
							digits: true,
						},
						'field_cont_fax[und][0][value]':{
							minlength: 4,
							maxlength: 8,
							chkbadchar:true,
							digits: true,
						},
						
						'field_cont_post[und][0][value]':{
							
							minlength: 10,
							maxlength: 255,
							chkbadchar:true,
						},
						
						
						'field_cont_state[und]':{
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '',
							
							},
							
					   'field_cont_pincode[und][0][value]':{							
							maxlength: 6,
							chkbadchar:true,
							digits:true,
							
							},
						
					
					},
                    messages: {
						    'field_cont_dept[und]':{
							required: 'Please Select Concerned Department',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							valuenotequals: 'Please Select Concerned Department',
							},
							
							'field_cont_org_name[und]':{
							required: 'Please Select Organsiation name',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please Select Organsiation name',
							
							},
							
							'field_cont_type[und]':{
							required: 'Please Select category name',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please Select category name',
							
							},
							'field_cont_salutation[und]':{
							required: 'Please Select salutation',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please Select salutation',
							
							},
							'title':{
							required:   'Please Enter the name',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please Enter the name',
							
							},
							'field_cont_desg[und][0][value]':{
							required:   'Please Enter the designation and postion',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please Enter the designation and postion',
							
							},
							'field_cont_email[und][0][value]':{							
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							email:'Please enter the valid Email-id',
							
							},
							'field_website[und][0][value]':{							
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							url:'Please enter the valid web address',
							
							},
							'field_cont_phone1[und][0][value]':{							
							minlength: 'Minimum 2 characters should be entered',
							maxlength: 'Maximum 6 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',		
							digits:'Please enter the numeric values',
							
							},
							'field_cont_phone[und][0][value]':{							
							minlength: 'Minimum 4 characters should be entered',
							maxlength: 'Maximum 8 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							digits:'Please enter the numeric values',
							
							},
							'field_cont_phone2[und][0][value]':{							
							minlength: 'Minimum 2 characters should be entered',
							maxlength: 'Maximum 6 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							digits:'Please enter the numeric values',
							
							},
							'field_cont_landline[und][0][value]':{							
							minlength: 'Minimum 4 characters should be entered',
							maxlength: 'Maximum 8 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							digits:'Please enter the numeric values',
							
							},
							'field_cont_mobile[und][0][value]':{							
							minlength: 'Minimum 10 characters should be entered',
							maxlength: 'Maximum 11 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							digits:'Please enter the numeric values',
							
							},
							'field_cont_cfax[und][0][value]':{							
							minlength: 'Minimum 2 characters should be entered',
							maxlength: 'Maximum 6 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',		
							digits:'Please enter the numeric values',
							},
							'field_cont_fax[und][0][value]':{							
							minlength: 'Minimum 4 characters should be entered',
							maxlength: 'Maximum 8 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',		
							digits:'Please enter the numeric values',
							},
							'field_cont_post[und][0][value]':{							
							minlength: 'Minimum 10 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',		
							
							},
							'field_cont_pincode[und][0][value]':{
							maxlength: 'Maximum 6 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							digits:'Please enter the numeric values',
							
							},
							'field_cont_state[und]':{
							required:   'Please select the state',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please select the state',
							
							},
							
							
	
				}, 
					//errorLabelContainer: "#errormsg_container",
					 //focusInvalid: false,
   					invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //contact("#actform-node-form").create_errormsg_container('errormsg_container','actform-node-form');
						}
							
							contact('html, body').animate({
								scrollTop: contact(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});
 /*errorLabelContainer: "#announcements-node-form",
						wrapper: "li",
  
	});
/*  errorPlacement: function(error, element) {
        element = element.closest('li');
        element = element.children(':first-child');
        error.insertBefore(element);
        error.addClass('message');
        contact(function() {                                 // my function
            var errorIndex = contact(error).index('div');
            var errorId = 'errordiv' + errorIndex.toString();
            contact(error).attr('id', errorId);
            contact('.errorList').append('<li><a href="#' + errorId + '">' + contact(error).text() + '</a></li>');
			contact("#announcements-node-form").before(element);
        });    
    },
*/

//// Title Validation
//    contact('#edit-title').rules("add", { 
//    		//notaccept: {'exp':"[a-zA-Z]+"},
//			chkbadchar: true,
//    		//required: true,
//         	minlength: 0,
//         messages: {
//            // required: "Title is required"  ,
//           // notaccept: 'Number is Not Allowed',
//			chkbadchar:'blah blah'
//         }
//        
//     });

            
});
